package ar.uade.distribuidas.tpo.dba.dominio;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "itemsCotizaciones")
public class ItemCotizacion {

	@Id
	long id;
	@ManyToOne
	private SolicitudDeCotizacion solicitud;
	@ManyToOne
	private ItemSolicitudDeCotizacion item;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public SolicitudDeCotizacion getSolicitud() {
		return solicitud;
	}

	public void setSolicitud(SolicitudDeCotizacion solicitud) {
		this.solicitud = solicitud;
	}

	public ItemSolicitudDeCotizacion getItem() {
		return item;
	}

	public void setItem(ItemSolicitudDeCotizacion item) {
		this.item = item;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		result = prime * result + ((item == null) ? 0 : item.hashCode());
		result = prime * result + ((solicitud == null) ? 0 : solicitud.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ItemCotizacion other = (ItemCotizacion) obj;
		if (id != other.id)
			return false;
		if (item == null) {
			if (other.item != null)
				return false;
		} else if (!item.equals(other.item))
			return false;
		if (solicitud == null) {
			if (other.solicitud != null)
				return false;
		} else if (!solicitud.equals(other.solicitud))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "ItemCotizacion [id=" + id + ", solicitud=" + solicitud + ", item=" + item + "]";
	}

}
